<h3>Users</h3>

<% content_for :sidemenu do %>
  <div style="text-align:right">
    <%= link_to "New User", new_admin_user_path, class: "button", id: "new_user_button" %>
  </div>
  <div class="admin_filters">
    <%= form_tag admin_users_path, method: 'get', id: "users_search" do %>
      <label>First Name</label>
      <%= text_field_tag :first_name, params[:first_name] %>

      <label>Last Name</label>
      <%= text_field_tag :last_name, params[:last_name] %>

      <label>Email</label>
      <%= text_field_tag :email, params[:email] %>

      <div style='text-align:center'>
        <%= submit_tag "Search", name: nil, class: "button" %>
      </div>
      <div id="users">
        <%= render 'users' %>
      </div>
    <% end %>
  </div>
<% end %>


<div class="admin_users">
  <table class='hover'>
    <thead>
    <tr class='odd'>
      <th  class='column1_header'><%= sortable "first_name" %></th>
      <th><%= sortable "last_name" %></th>
      <th><%= sortable "email" %></th>
      <th>Status</th>
    </tr>
    </thead>
    <% @users.each do |user| %>
      <tr class='<%= cycle("odd", "")%>'>
        <td><%= link_to user.first_name, admin_user_path(user) %></td>
        <td><%= user.last_name %></td>
        <td><%= user.email %></td>
        <td><%= user.state %></td>
      </tr>
    <% end %>
  </table>

  <%= will_paginate @users %>
</div>

